<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>不予开票</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="${ctx}/rs/js/jquery.validate.min.js"></script>
<script src="${ctx}/rs/js/jquery.form.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" class="form-horizontal"  enctype="multipart/form-data">
     
      
       <div class="form-group">
        <label for="name" class="col-sm-3 control-label item wid1">不予开票缘由</label>
        <div class="col-sm-6 wid2">
          <textarea class="form-control reason" placeholder=" 请输入不超过150个字的回复内容 " id="explains" name = "explains" row = 3 style="width:200px;"></textarea> 
            <span style="color:#FF9966">*</span>
          <input type="hidden" id= "billintId" name = "billintId"class="form-control " value="${Detail.billintId }" />
          <input type="hidden" id= "status" name="status" class="form-control " value="1" />
          <input type="hidden" id= "startTime" name="startTime" class="form-control " value="${Detail.startTime }" />
          <input type="hidden" id= "endTime" name="endTime" class="form-control " value="${Detail.endTime }" />
        </div>
      </div>
           <div class="form-group">
        <div class="col-sm-10 text-center pt15">
             <button type="button" class="btn btn-primary btn-lg srt-btn active mr30" onclick="valiSubmit()">提交</button>
        </div>
      </div>
</form>
<script type="text/javascript" src="${ctx}/rs/js/bootstrapQ.min.js"></script>
<script src="${ctx}/rs/js/messages_zh.min.js"></script>
<script type="text/javascript">

//初始化验证 start
var form = $('#form1');
form.validate({
    rules: {
    	explains: {
            maxlength: 150,
            required: true
        }
      },
      highlight: function(element) {
          $(element).closest('.form-group').removeClass('success').addClass('error');
      },
      success: function(element) {
          element.text('OK!').addClass('valid')
          .closest('.form-group').removeClass('error').addClass('success');
      }
});
/** end */

function valiSubmit() {
    if (form.valid()) {
        var data = $("#form1").serialize();      //获取表单多个控件的数据
        $(".unable").show();
        $.ajax({
            url: "${ctx}/billing/save.htm",
            type: "post",
            data: data,
            success: function (text) {
                if(!$('.unable').is(':hidden')){
                    $(".unable").hide();
                }
                // 普通消息提示条
               alert("操作成功");
                //触发隐藏确认的按钮，引用回调方法关闭窗口并刷新列表
                $("button.bsok").click();
            }
        });
    }
}
   

</script>
</body>
</html>